<%
var headerPart = {
%>
<script type="text/javascript">
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
</script>
<% }; %>
<% layout("/layouts/micro.html",{headerSection:headerPart}){ %>
<div class="layui-fluid">
	<div class="layui-card">
 <!--<div class="layui-tab layui-tab-brief childrenBody">
      <ul class="layui-tab-title">
         <li class="layui-this"><a href="${ctx}/sys/sequence/">序列键列表</a></li>
         <%if(shiro.hasPermission("sys:sequence:edit")){%><li><a href="${ctx}/sys/sequence/form">序列键添加</a></li><%}%>
	</ul>-->
	<form id="searchForm" action="${ctx}/sys/sequence/" method="post" class="layui-form layui-card-header layuiadmin-card-header-auto">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">键值名称：</label>
				<div class="layui-input-block">
					<input type="text" name="name" htmlEscape="false" maxlength="200" class="layui-input"/>
				</div>
			</div>
			<div class="layui-inline">
				<button class="layui-btn layuiadmin-btn-useradmin" lay-submit="" lay-filter="LAY-enrollList-search">
					<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
				</button>
			</div>
		</div>
	</form>
	<div class="layui-card-body">
		<#message content="${message!}"/>
		<%if(shiro.hasPermission("sys:sequence:edit")){%>
		<div>
			<button class="layui-btn layui-btn-normal LAY_ADD_sequence_btn"><i class="layui-icon layui-icon-add-1"></i>序列键添加</button>
		</div>
		<%}%>
		<table class="layui-table" lay-even>
			<thead>
				<tr>
					<th>键值名称</th>
					<th>初始值</th>
					<th>键值递增</th>
					<th>键值类型</th>
					<th>长度类型</th>
					<th>序列键长度</th>
					<th>修饰类型</th>
					<th>序列键修饰</th>
					<th>序列日期</th>
					<th>按日期循环增加</th>
					<th>循环初值</th>
					<th>日期序列</th>
					<th>示例</th>
					<!--<th>上次序列开始时间</th>-->
					<%if(shiro.hasPermission("sys:sequence:edit")){%>
						<th width="100px;">操作</th>
					<%}%>
				</tr>
			</thead>
			<tbody>
				<%for(sequence in page.list){%>
				<tr>
					<td><a href="${ctx}/sys/sequence/form?id=${sequence.name}">
						${sequence.name}
					</a></td>
					<td>
						${sequence.currentValue}
					</td>
					<td>
						${sequence.incrementValue}
					</td>
					<td>
						${@DictUtils.getDictLabel(""+sequence.uuidType, 'uuid_type', '')}
					</td>
					<td>
						${@DictUtils.getDictLabel(""+sequence.keyLenType, 'key_len_type', '')}
					</td>
					<td>
						${sequence.keyLen}
					</td>
					<td>
						${@DictUtils.getDictLabel(""+sequence.keyFixType, 'key_fix_type', '')}
					</td>
					<td>
						${sequence.keyFix}
					</td>
					<td>
						${@DictUtils.getDictLabel(""+sequence.keyDateType, 'key_date_type', '')}
					</td>
					<td>
						${@DictUtils.getDictLabel(""+sequence.keyDateLoop, 'key_date_loop', '')}
					</td>
					<td>
						${sequence.keyDateLoopInit}
					</td>
					<td>
						${@DictUtils.getDictLabel(""+sequence.keyDateFormat, 'key_date_format', '')}
					</td>
					<td>
						${sequence.example}
					</td>
					<!--<td>
						${sequence.keyDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
					</td>-->
					<%if(shiro.hasPermission("sys:sequence:edit")){%><td>
						<a class="layui-btn layui-btn-xs" onclick="editSequence('${sequence.name}')" href="javascript:void(0);">修改</a>
						<a class="layui-btn layui-btn-xs layui-btn-danger" href="${ctx}/sys/sequence/delete?id=${sequence.name}" onclick="return confirmx('确认要删除该序列键吗？', this.href)">删除</a>
					</td>
					<%}%>
				</tr>
			<%}%>
			</tbody>
		</table>
		<div class="pagination">${page}</div>
	</div>
	</div>
</div>
<script>
    layui.use(['form','layer'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery;
        //添加
        $(".LAY_ADD_sequence_btn").click(function(){
            var index = layui.layer.open({
                title : "添加序列键",
                type : 2,
                content : "${ctx}/sys/sequence/form",
                maxmin: true,
                area: ['1000px', '550px'],
                btn: ['确定', '取消'],
                yes: function(index, layero){
                    var submit = layero.find('iframe').contents().find('#sequenceForm');
                    submit.trigger('click');
                    layer.close(index);
                },
                end:function(){
                    location.reload();
                }
            })
        })
    })
    var editSequence = function(id){
        var index = layui.layer.open({
            title : "修改序列键",
            type : 2,
            content : "${ctx}/sys/sequence/form?id="+id,
            maxmin: true,
            area: ['1000px', '550px'],
            btn: ['确定', '取消'],
            yes: function(index, layero){
                var submit = layero.find('iframe').contents().find('#sequenceForm');
                submit.trigger('click');
                layer.close(index);
            },
            end:function(){
                location.reload();
            }
        })
    }
</script>
<%}%>